<?php

namespace api\ggz\model;

use think\Model;

class QualificationsModel extends Model
{
    /**
     * 模型名称
     * @var string
     */
    protected $name = 'qualifications';

    protected $type = [
        'more' => 'array',
    ];

    public  function  modify(array $where,array $data){
        return  $this->where($where)->update($data);
    }

    public function getDataById($id=null){
        return $this->alias('a')
            ->field('a.*,b.value as type_val,c.value as sale_type_val,h.nickname,h.phone as customer_tel')
            ->join('config_set b','a.type=b.id','left')
            ->join('config_set c','a.sale_type=c.id','left')
            ->join('customer h','a.uid=h.id','left')
            ->where(['a.id'=>$id])->find();
    }
}